package com.fkjslee.hos;

import java.lang.reflect.Field;

/**
 * @author fkjslee
 * @date 2018/1/1 at 15:19
 * Copyright (c) 2018 fkjslee. All rights reserved.
 */

public class Method {
    public static void toString(Object o) {
        System.out.println("className = " + o.getClass().getName());
        Field[] fields = o.getClass().getDeclaredFields();
        for(int i = 0; i < fields.length; ++i) {
            fields[i].setAccessible(true);
            try {
                System.out.println("propertyName = " + fields[i].getName() +
                "  value = " + fields[i].get(o));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
